package test.ground.cotroller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import test.ground.model.ResponseModel;

import java.util.Date;

/**
 * @Author wangshaopeng
 * @Date 2021/1/5
 */
@Controller
@RequestMapping("/model")
public class ModelC {

    @ResponseBody
    @RequestMapping("/r")
    public ResponseModel r(ResponseModel responseModel){
        return responseModel;
    }

    @RequestMapping("/r2")
    public ResponseModel r2(ResponseModel responseModel){
        return responseModel;
    }

    @ResponseBody
    @RequestMapping("/w")
    public ResponseModel w(ResponseModel responseModel,@RequestParam(defaultValue = "2020-10-10") Date date){
//        responseModel.setDate(date);
        return responseModel;
    }

    @ResponseBody
    @RequestMapping("/b")
    public ResponseModel b( @RequestBody ResponseModel responseModel){
//        throw new IllegalArgumentException();
        return responseModel;
    }



    public Object test_() throws Throwable{
        //The selected code has been copied
        return null;
    }

}
